<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
		</style>
	</head>
	<script src="../js/jquery-3.5.1.min.js"></script>
	<body>
		<h2>添加空气质量信息</h2><br>
		<div >
			检测区域:<select  name = "districtName" id = "disname" >
						<option  th:each="dis:${dis}" th:text="${dis.name}" th:value="${dis.id}">未知</option>
					</select><br>
			检测日期:<input type="date" id = "jcrq" name="monitorTime"/><br>
			PM10值：<input id = "p" type="" name="pm10"/><br>
			PM2.5值:<input id = "m" type="" name="pm25"/><br>
			检测站：<select name = "monitoringStation" id = "jcz">
						<option  th:each="air:${air}" th:text="${air.monitoringStation}" >好好好</option>
					</select><br>
			<button type="button" id = "add">保存</button>
			<button type="button">重置</button>
			<button type="button">返回</button>
		</div>
	</body>
<script>
	$(function () {
		$("#add").click(function(){
			var disname = $("#disname").val();
			var jcrq = $("#jcrq").val();
			var p = $("#p").val();
			var m = $("#m").val();
			var jcz = $("#jcz").val();
			$.ajax({
				type:"post",
				url:'[[@{/air/add}]]',
				data:{"districtId":disname,"monitorTime":jcrq,"pm10":p,"pm25":m,"monitoringStation":jcz},
				dataType:'json',
				success:function (data) {
					if(data){
						alert("添加成功");
						window.location.href="[[@{/air/list}]]";
					}
				}
			})
	})
	});
</script>
</html>
